<%try{ %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="displayTag"%>
<%@ page import = "com.app.sgd.util.SessionConstants" %>
<%@ page import = "com.app.sgd.util.Constants" %>
<%@ page import = "java.util.*" %>
<%@ page import = "com.app.sgd.model.bean.ExpedienteSTDBean" %>

<%ArrayList<ExpedienteSTDBean> lstTotal = (ArrayList<ExpedienteSTDBean>)session.getAttribute(SessionConstants.LISTA_EXPEDIENTES_MOSTRAR); 
  if(lstTotal == null) lstTotal = new ArrayList<ExpedienteSTDBean>();
%>

<html:html>
<script language="JavaScript" src="<%=request.getContextPath()%>/jscript/javascript.js"></script>
<script language="JavaScript" src="<%=request.getContextPath()%>/jscript/validar.js"></script>
<script language="JavaScript" src="<%=request.getContextPath()%>/jscript/checksValida.js"></script>
<script language="JavaScript" src="<%=request.getContextPath()%>/jscript/expediente_js.js"></script>

<script language="JavaScript">

</script>

<BODY>

<html:form styleId="form" action="Expediente.do" method="post" scope="session">
	<input type="hidden" name="method" value=""/>
	<input type="hidden" name="index" value="-1"/>

	
<table id="tabla1" border=0 style="Z-INDEX:102;TOP:5px;top:0;" align="center" width="100%">
<tr>	
<td valign=top align=left>
	<TABLE align="center" width="100%">
		<TR>
		<TD align="center">
			<TABLE width="100%" class="search" cellspacing="0" cellpadding="0" align="center">
				<caption>LISTADO DE EXPEDIENTES</caption>
				<TBODY>
					<tr> 
					 	<td colspan="6">
					      	<a href='javascript:nuevoExpediente()'>
					          <img src="images/top/docu1_1.gif" alt="Crear nuevo Expediente" name="nuevo" width="23" height="21" border="0"></a>
							&nbsp;
							<a href="javascript:exportarExcel()">
						    	<img src="images/top/excel_1.jpg" width="23" height="21" alt="Exportar a excel" name="exportar" border="0"></a>
						</td>
					</tr>
					<tr>
						<td>
							Expediente Nro:
						</td>
						<td>
							<html:text property="numExpedienteBusq" readonly="false" styleClass="tEdit"/>
						</td>
						
						<td>
							Estado:&nbsp;&nbsp;&nbsp;
							<html:select property="codTipoEstadoBusq">
								<html:option value="0"><%=Constants.VALOR_DEFAULT_TODOS%></html:option>
								<html:options collection="<%=SessionConstants.LISTA_ESTADO_EXPEDIENTE%>" property="value" labelProperty="label"/>
							</html:select>
						</td>
					</tr>
					<TR>
						<td>
							Oficina:
						</td>
						<td>
							<html:select property="codOficinaBusq">
								<!--<html:option value="0"><%//=Constants.VALOR_DEFAULT_TODOS%></html:option>-->
								<html:options collection="<%=SessionConstants.LISTA_CONSULTAS_OFICINAS%>" property="value" labelProperty="label"/>
							</html:select>
						</td>
						<TD>Desde:&nbsp;&nbsp;&nbsp;
							<html:text
								property="fechaInicio" styleClass="tEdit" style="width:90"
								maxlength="10" onkeypress="javascript:esFecha(event)" />
							<a href="javascript:void(0)"
								onclick="if(self.gfPop)gfPop.fStartPop(document.forms[0].fechaInicio,'');return false;">
							<img class="PopcalTrigger" src="_commons/calendar/calbtn.gif"
								alt="" align="middle" border="0" height="22" width="34"> </a>
							&nbsp;&nbsp;&nbsp;Hasta: 
							<html:text
								property="fechaFin" styleClass="tEdit" style="width:90"
								maxlength="10" onkeypress="javascript:esFecha(event)" />&nbsp;
							<a href="javascript:void(0)"
								onclick="if(self.gfPop)gfPop.fEndPop('',document.forms[0].fechaFin);return false;">
							<img class="PopcalTrigger" src="_commons/calendar/calbtn.gif"
								alt="" align="middle" border="0" height="22" width="34"> </a>
							&nbsp;&nbsp;&nbsp;
						</TD>
					</TR>
					<tr>
						<td>
							Documentos: 
						</td>
						<td>
							<html:select property="tipoBandejaBusqueda">
								<html:option value="T"><%=Constants.VALOR_DEFAULT_TODOS%></html:option>
								<html:option value="E">ENVIADOS</html:option>
								<html:option value="R">RECIBIDOS</html:option>
							</html:select>
						</td>
					</tr>
					<TR>
						<td colspan="6" align="center">
							<br><INPUT type="button" onclick="javascript:buscarExpedientesSTD()" value="  Buscar  " class="button"> 
						</td>
					</TR>
					<tr>
						<td><br/></td>
					</tr>
				</TBODY>
			</TABLE>
		</TD>
		</TR>
	</TABLE>
</td>
</tr>
<logic:notEmpty name="<%=SessionConstants.LISTA_EXPEDIENTES_MOSTRAR%>" scope="session">
<tr>
	<td align="right"><font face="Arial" size="2"><b><%=lstTotal.size()%> expediente(s)</b></font>&nbsp;&nbsp;&nbsp;</td>
</tr>
</logic:notEmpty>
<tr>
<td>
	<logic:present name="<%=SessionConstants.LISTA_EXPEDIENTES_MOSTRAR%>" scope="session">
		<displayTag:table title=""  name="<%=SessionConstants.LISTA_EXPEDIENTES_MOSTRAR%>" 
					  requestURI="Expediente.do?method=siguiente" summary="true"
					  scope="session" pagesize="<%=Constants.DISPLAYTAG_TABLE_PAGE_SIZE%>" id="expediente" width = "100%">

			<displayTag:column title="Numero" property="numeroExpedienteEnlace" width="10%" align="center"/>
			 
			<displayTag:column title="Oficina" property="siglasArea" width="5%" align="center"/>	
			<displayTag:column title="Descripcion" property="asuntoExpediente" width="20%" align="left"/>
			<displayTag:column title="Fecha" property="fechaExpediente" width="10%" align="center"/>
			<displayTag:column title="Estado" property="descripcionEstado" width="20%" align="center"/>
			
           	<displayTag:column title="Total documentos asociados" width="15%" align="center">
           		<logic:equal name="expediente" property="codigoEstado" value="<%=Constants.ESTADO_EXPEDIENTE_ANULADO%>">
           			<bean:write name="expediente" property="totalDocumentos"/>
           		</logic:equal>
           		<logic:notEqual name="expediente" property="codigoEstado" value="<%=Constants.ESTADO_EXPEDIENTE_ANULADO%>">
	        		<A href='javascript:listarDocumentos(<bean:write name="expediente" property="indiceExpediente"/>)'>
	        		 	<bean:write name="expediente" property="totalDocumentos"/>
	        		</A>
        		</logic:notEqual>
           	</displayTag:column>
           	
           	<displayTag:column title="" property="asociarDocumentosEnlace" width="25%" align="center"/>

		</displayTag:table>
	</logic:present>
</td>
</tr>
</table>

</html:form>

<iframe width=132 height=142 name="gToday:contrast:agenda.js"
	id="gToday:contrast:agenda.js" src="_commons/calendar/ipopeng.htm"
	scrolling="no" frameborder="0"
	style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
</iframe>

</BODY>
</html:html>
<%}catch(Exception e) {e.printStackTrace();}%>